yjx.controller('orderClientController',['$rootScope','$scope','$timeout','$stateParams','$fetch','modalService','$state',function($rootScope,$scope,$timeout,$stateParams,$fetch,modalService,$state){
    var id = $stateParams.id,
    type = $stateParams.type && $stateParams.type>1?$stateParams.type: 1;

    /*获取客户列表*/
    function getClientList() {
        $fetch.fetch(
            '/customer/getList',
            {
                params:{
                    userId:$rootScope.userId
                },
                cache:false,
            }
        ).then(function (data) {
                $timeout(function(){
                    if(data) {
                        /*客户列表中如何添加自己  自己的客户数据从哪来 保存在哪*/
                        $scope.reservationList = data
                        //console.log( $scope.reservationList);
                    }
                })
            }).catch(function (e) {
                modalService.mainMsgError(e.msg);
            })
    }
    getClientList();

    $scope.onClick = function(id){
        $scope.clientId = id;
    }

    $scope.orderPay =function(){
        if(!$scope.clientId){
            return
        }
        $state.go('order', {id: id,clientId:$scope.clientId,forwardId:$rootScope.userId,type:type})
    }


}])